<?php
/**
 * +-------------------------------------------------------------
 * |Caption:
 * +-------------------------------------------------------------
 * |Author: Lenny
 * +-------------------------------------------------------------
 * |Email:  1685964109@qq.com
 * +-------------------------------------------------------------
 * |Date:   2024/7/2 下午5:38
 * +-------------------------------------------------------------
 */

namespace app\admin\validate;

use think\Validate;

class AdminValidate extends Validate
{

    protected $rule = [
        'username'   => 'require|max:20|unique:sys_admin',
        'password'   => 'require',
        'repassword' => 'require|confirm:password',
    ];

    protected $message = [
        'username.require' => '用户名不能为空',
        'username.max'     => '用户名长度不能超过20个字符',
        'username.unique'  => '用户名已存在',

        'password.require'   => '密码不能为空',
        'repassword.require' => '确认密码不能为空',
        'repassword.confirm' => '两次输入的密码不一致',
    ];

    protected $scene = [
            'add'      => ['username'],
            'password' => ['password','repassword'],
    ];
}